package com.msb.apipassenger.service;

import com.msb.apipassenger.remote.ServicePassengerUserClient;
import com.msb.internalcommon.dto.PassengerUser;
import com.msb.internalcommon.dto.ResponseResult;
import com.msb.internalcommon.dto.TokenResult;
import com.msb.internalcommon.request.VerificationCodeDTO;
import com.msb.internalcommon.util.JWTUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: WuWen
 * @Date: 2023/8/17 - 08 - 17 - 19:32
 * @Description: com.msb.apipassenger.service
 * @version: 1.0
 */
@Service
@Slf4j
public class UserService {

    @Autowired
    ServicePassengerUserClient servicePassengerUserClient;

    public ResponseResult getUsersByAccessToken(String accesstoken){
        log.info("accessToken是："+accesstoken);

        // 解析token，拿到手机号
        TokenResult tokenResult = JWTUtils.checkToken(accesstoken);
        String phone = tokenResult.getPhone();
        log.info("手机号是："+phone);

        //通过手机号拿到用户信息
        ResponseResult responseResult = servicePassengerUserClient.getUserByPhone(phone);


//        PassengerUser passengerUser = new PassengerUser();
//        passengerUser.setPassengerName("小李");
//        passengerUser.setProfilePhoto("smile");

        return responseResult;
    }


}
